/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * RMiddleProgJPanel.java
 *
 * Created on 2011-6-30, 17:56:47
 */
package seso;

/**
 *
 * @author Administrator
 */
public class RMiddleProgJPanel extends javax.swing.JPanel {
    
    /** Creates new form RMiddleProgJPanel */
    public RMiddleProgJPanel() {
        initComponents();
    }
    
    public RMiddleProgJPanel(String programTitle, java.awt.Image image) {
        initComponents();
        
        int maxLength = 38;
        if (programTitle.length() > maxLength)
            rMiddleProgTitle.setText(programTitle.substring(0, maxLength) + "...");
        else
            rMiddleProgTitle.setText(programTitle);
        
        rMiddleProgTitle.setCaretPosition(1);
        
        middleProgRImageBox.setImage(image);
        middleProgRImageBox.setFillMethod(1);
    }
    
    public void updateImage(java.awt.Image image){
        middleProgRImageBox.setImage(image);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rMiddleProgTitle = new seso.RMiddleProgTitle();
        middleProgRImageBox = new seso.RImageBox();

        setName("Form"); // NOI18N
        setOpaque(false);
        setPreferredSize(new java.awt.Dimension(300, 300));
        setLayout(null);

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(seso.SesoApp.class).getContext().getResourceMap(RMiddleProgJPanel.class);
        rMiddleProgTitle.setForeground(resourceMap.getColor("rMiddleProgTitle.foreground")); // NOI18N
        rMiddleProgTitle.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        rMiddleProgTitle.setText(resourceMap.getString("rMiddleProgTitle.text")); // NOI18N
        rMiddleProgTitle.setFocusable(false);
        rMiddleProgTitle.setMargin(new java.awt.Insets(1, 6, 1, 6));
        rMiddleProgTitle.setName("rMiddleProgTitle"); // NOI18N
        add(rMiddleProgTitle);
        rMiddleProgTitle.setBounds(15, 274, 270, 26);

        middleProgRImageBox.setText(resourceMap.getString("middleProgRImageBox.text")); // NOI18N
        middleProgRImageBox.setName("middleProgRImageBox"); // NOI18N
        add(middleProgRImageBox);
        middleProgRImageBox.setBounds(0, 0, 300, 270);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private seso.RImageBox middleProgRImageBox;
    private seso.RMiddleProgTitle rMiddleProgTitle;
    // End of variables declaration//GEN-END:variables
}
